home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / sal100 / quick.src < prev    next >
Encoding:
Text File  |  1993-06-03  |  421 b   |  25 lines

  1. void QuickSort(int left, int right)
  2.   int i;
  3.   int j;
  4.   int x;
  5.  
  6.   i = left;
  7.   j = right;
  8.   x = Vektor[left+right / 2]
  9.   do
  10.   {
  11.     while ( Vektor[i] < x && i < right ) i++;
  12.     while ( x < Vektor[j] && j > left ) j--;
  13.     if (i <= j)
  14.     {
  15.         SwapNumbers(i,j);
  16.         i++;
  17.         j--;
  18.     }
  19.   }
  20.   while (i <= j);
  21.   if (left < j) QuickSort(left,j);
  22.   if (i < right) QuickSort(i,right);
  23. }
  24.